package live.common;

import java.util.Map;

import org.apache.log4j.Logger;

public class GetSequence {
	 static Logger log = Log4jXmlConfig.getInstance().returnLogger(GetSequence.class);
	 public static synchronized	String returnSeqNum()
	  {
	    DBHelper db = DBHelper.getInstance();
	    Map map = null;
	    String date = null;
	    String seqNum = null;
	    try {
	      map = (Map)db.queryRecordMap("{call P_GetNewSeqVal_SeqT()}");
	      seqNum = map.get("SeqNum").toString();
	      db.close();
	    }
	    catch (Exception e) {
	    	log.error("流水号获取异常",e);
	    	seqNum = null;
	    }finally{
		    if (seqNum == null) {
		      seqNum = Format.getInstance().returnSystemNum();
		    }
	    }
	    return seqNum;
	  }
//
//	  private static String returnZeroStr(int numLen)
//	  {
//	    String strZero = "";
//	    for (int j = 0; j < 9 - numLen; ++j) {
//	      strZero = strZero + "0";
//	    }
//	    return strZero;
//	  }
	
}
